home *** CD-ROM | disk | FTP | other *** search
- // istread -- istream::read(char *, int)
-
- #include <istream>
-
- istream& istream::read(char *s, int n)
- { // get at most n bytes
- _Chcount = 0;
- _TRY_IO_BEGIN
- if (ipfx(1))
- { // extract arbitrary characters
- int ch;
- for (; 0 < n; --n)
- if ((ch = rdbuf()->sbumpc()) == EOF)
- { // record eof and quit
- setstate(failbit);
- break;
- }
- else
- *s++ = ch, ++_Chcount;
- }
- isfx();
- _CATCH_IO_END
- return (*this);
- }
-
-